package com.hj.common;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 *@Description 时间工具类
 *@Author yangg
 *@Date 2018/11/27
 *@Time 10:50
 */
public class DateUtils {

    /**
     *@Description 将LocalDateTime类型转为String类型
     *@Author yangg
     *@Date 2018/11/27
     *@Time 11:33
     */
    public static String localDateTimeTurnString(LocalDateTime localDateTime){
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return df.format(localDateTime);
    }

    /**
     *@Description 将LocalDate类型转为String类型
     *@Author yangg
     *@Date 2018/11/27
     *@Time 11:35
     */
    public static String localDateTurnString(LocalDateTime localDate){
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return df.format(localDate);
    }
}
